import Vue from 'vue'
import Router from 'vue-router'
import Common from '../utils/Common.vue'
import userLogin from '../components/userLogin.vue'
import adminLogin from '../components/adminLogin.vue'

import userMainPage from '../components/user/userMainpage'
import userMy from '../components/user/userMy'
import userBadmintonHall from '../components/user/userBadminton'
import userVolleyballHall from '../components/user/userVolleyball'
import userPingpangHall from '../components/user/userPingpang'
import userTennisHall from '../components/user/userTennis'
import userBasketballHall from '../components/user/userBasketball'

import adminMainPage from '../components/admin/adminMainpage'
import adminBadmintonHall from '../components/admin/adminBadminton'
import adminVolleyballHall from '../components/admin/adminVolleyball'
import adminPingpangHall from '../components/admin/adminPingpang'
import adminTennisHall from '../components/admin/adminTennis'
import adminBasketballHall from '../components/admin/adminBasketball'

Vue.prototype.Common=Common
Vue.use(Router)

const router  = new Router({
  routes: [
    {
      //用户登录
      path:'/',
      //path:'/admin/cookies',
      name:"userLogin",
      component:userLogin
    },
    {
      //管理员登陆
      path:'/adminLogin',
      name:"adminLogin",
      component:adminLogin
    },

    //用户
    {
      path: '/userMainPage',
      //path:'/',
      name: "userMainPage",
      component: userMainPage, 
      redirect: '/userMy',
      children: [
        {
          //我的
          path:'/userMy',
          component:userMy,
          name: "userMy"
        },
        {
          //羽毛球馆
          path:'/userBadminton',
          component:userBadmintonHall,
          name:'userBadminton'
        },
        {
          //排球馆
          path:'/userVolleyball',
          component: userVolleyballHall,
          name: "userVolleyball",
        },
        {
          //乒乓球馆
          path:'/userPingpang',
          component:userPingpangHall,
          name:"userPingpang",
        },
        {
          //网球馆
          path:'/userTennis',
          component:userTennisHall,
          name:"userTennis",
        },
        {
          //篮球馆
          path:'/userBasketball',
          component:userBasketballHall,
          name:"userBasketball"
        }
      ]
    },
    //管理员
    {
      path: '/adminMainPage',
      //path:'/',
      name: "adminMainPage",
      component: adminMainPage, 
      redirect: '/adminBadminton',
      children: [
        {
          //羽毛球馆
          path:'/adminBadminton',
          component:adminBadmintonHall,
          name:'adminBadminton'
        },
        {
          //排球馆
          path:'/adminVolleyball',
          component: adminVolleyballHall,
          name: "adminVolleyball",
        },
        {
          //乒乓球馆
          path:'/adminPingpang',
          component:adminPingpangHall,
          name:"adminPingpang",
        },
        {
          //网球馆
          path:'/adminTennis',
          component:adminTennisHall,
          name:"adminTennis",
        },
        {
          //篮球馆
          path:'/adminBasketball',
          component:adminBasketballHall,
          name:"adminBasketball"
        }
      ]
    },
    
  ]
})

export default router